package com.tang.jvm.init;

/**
 * @author Tang
 * @classname SuperClass
 * @description [  ]
 * @date 2022/5/23 9:45
 */
public class Init1 {
    public static void main(String[] args) {
        // 对于静态字段，只会初始化其直接定义的类,通过其子类引用父类的字段，子类不会进行初始化，父类会进行初始化,SubClass不会被初始化
//        System.out.println(SubClass.value);

        //
        SuperClass[] subClasses = new SuperClass[0];

    }
}

class SuperClass {

    static {
        System.out.println("SuperClass init");
    }

    public static int value = 10;
}

class SubClass extends SuperClass {
    static {
        System.out.println("SubClass init");
    }
}